<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container-fluid">
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 
          <span class="icon-bar"></span>
          <span class="icon-bar"></span> 
          <span class="icon-bar"></span>
        </a> 
        <a class="brand" href="#">URL2Sql</a>
          
        <div class="nav-collapse">
          <ul class="nav">
            <li sign="index"><a href="index">首页</a></li>
            <li sign="interceptor"><a href="interceptor">拦截器</a></li>
            <li sign="tools"><a href="tools">Sql工具</a></li>
            <li><a id="reload" href="#">重新加载</a></li>
          </ul>
          <p class="navbar-text pull-right">
            <a href="#">退出</a>
          </p>
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>
</div>

<script type="text/tmpl" id="msg-tmpl">
  <div class="alert fade in {{if !success}}alert-error{{/if}}">
      <a class="close" data-dismiss="alert" href="#">&times;</a>
 	    <strong>重新加载${msg}！</strong> 最后更新时间<span who="time">${time}</span>
  </div>
</script>
<script type="text/javascript">
	var url = window.location.href.replace(window.location.hash, '');
	url = url.substring(url.lastIndexOf('/')+1);
	$('.navbar [sign="'+url+'"]').attr('class', 'active');
	$('#reload').click(function(){
		var url = "reload.json";
		var retVal = {};
		$.ajax({
			'async' : false,
			'type' : "post",
			'url' : url,
			'data' : {},
			'dataType' : 'json',
			'success' : function(json){
				retVal.time = json.time;
				if(json.code==0){
					retVal.msg = "成功";
					retVal.success = true;
				}else{
					retVal.msg = "失败";
					retVal.success = false;
				}
			}
		});
		
		var msg = $('#msg');
		msg.empty();
		var msgTmpl = $('#msg-tmpl').tmpl(retVal);
		msgTmpl.appendTo(msg);
		return false;
	});
</script>